package com.example.cinema.bindingdata;

import android.view.View;
import android.widget.ImageView;

import androidx.databinding.BindingAdapter;
import androidx.databinding.ObservableField;

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.example.cinema.R;

public class LiveTableData {

    @BindingAdapter("liveimg")
    public static void LiveImg(View view,String url)
    {
        if(url!=null)
        {
            RequestOptions options = new RequestOptions()
                    .placeholder(R.mipmap.defaut_img)
                    .error(R.mipmap.defaut_img)
                    .fallback(R.mipmap.defaut_img);
            Glide.with(view).load(url)
                    .apply(options)
                    .into((ImageView) view);
        }
    }


    public ObservableField<String> livesid = new ObservableField<>();//直播ID
    public ObservableField<String> livepath = new ObservableField<>();//拉流地址
    public ObservableField<String> livetype = new ObservableField<>();//直播类型
    public ObservableField<String> livename = new ObservableField<>();//直播名称
    public ObservableField<String> livestate = new ObservableField<>();//直播状态
    public ObservableField<String> livecover = new ObservableField<>();//直播封面
    public ObservableField<String> livetext = new ObservableField<>();//直播说明
    public ObservableField<String> livetag = new ObservableField<>();//直播标签
    public ObservableField<String> liverelay = new ObservableField<>();//直播源地址

}
